package controller;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

import pojo.Protocol;
import socket.ClientSocket;
import util.ProtocolJSONConverter;

public class RegistController {
	public void control(String from, String pwd) throws IOException{
		OutputStream out = ClientSocket.getInstance().getOutputStream();
		Protocol protocol = new Protocol(Protocol.REGISTER, pwd, from, null, null);
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
		writer.write(ProtocolJSONConverter.toJSON(protocol) + "\r\n");
		writer.flush();
	}

}
